package com.itheima.springbootenable;

import com.itheima.springbootenableother.config.MyImportSelector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import redis.clients.jedis.Jedis;

@SpringBootApplication
//@Import(UserConfig.class)
//@EnableUser     //本质和@Import一样,但是更加通用
//@Import(User.class)
//@Import(UserConfig.class)
@Import(MyImportSelector.class)
public class SpringbootEnableApplication {

    @Bean
    public Jedis jedis(){
        return new Jedis();
    }

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootEnableApplication.class, args);
//        Object user = context.getBean("user");

//        User user = context.getBean(User.class);
//        System.out.println(user);
//
//        Role role = context.getBean(Role.class);
//        System.out.println(role);


        Jedis jedis = context.getBean(Jedis.class);
        System.out.println(jedis);




    }

}
